//
//  HuongInfoCell_iPad.m
//  PhongThuyHuongNha
//
//  Created by Le Anh Tai on 10/20/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "HuongInfoCell_iPad.h"
#import "UIConstants.h"

@implementation HuongInfoCell_iPad

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _xauLabel = [[UILabelEx alloc] initWithTitle:@"" titleFont:_label.title.font content:@"" contentFont:_label.content.font];
        _xauLabel.title.textAlignment = NSTextAlignmentCenter;
        _xauLabel.content.textAlignment = NSTextAlignmentCenter;
        _xauLabel.backgroundColor = [UIColor clearColor];
        [_subView addSubview:_xauLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    _label.titleWidth = _subView.width/4;
    _label.frame = RECT(0, 0, _subView.width/2, _subView.height);
    
    _xauLabel.titleWidth = _subView.width/4;
    _xauLabel.frame = RECT(_label.right, 0, _subView.width - _label.right, _subView.height);
}

- (void)setTextTotColor:(UIColor *)totColor xauColor:(UIColor *)xauColor
{
    _label.title.textColor = totColor;
    _label.content.textColor = totColor;
    
    _xauLabel.title.textColor = xauColor;
    _xauLabel.content.textColor = xauColor;
}

- (void)loadHuongTot:(NSArray *)huongTot
{
    if (huongTot == nil || huongTot.count < 1)
    {
        return;
    }
    
    _label.title.text = [huongTot objectAtIndex:0];
    _label.content.text = [huongTot objectAtIndex:1];
}

- (void)loadHuongXau:(NSArray *)huongXau
{
    if (huongXau == nil || huongXau.count < 1)
    {
        return;
    }
    
    _xauLabel.title.text = [huongXau objectAtIndex:0];
    _xauLabel.content.text = [huongXau objectAtIndex:1];
}
@end
